package com.suncaper.shop.domain;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

/**
 * 购物项
 */

public class CartItem {

    private Product product;

    private Double subtotal;

    private Integer count;

    public Product getProduct() {
        return product;
    }

    public void setProduct(Product product) {
        this.product = product;
    }

    /**
     * 获取商品小计
     *
     * @return
     */
    public Double getSubtotal() {
        return product.getShopPrice() * count;
    }

    public void setSubtotal(Double subtotal) {
        this.subtotal = subtotal;
    }

    public Integer getCount() {
        return count;
    }

    public void setCount(Integer count) {
        this.count = count;
    }

    public CartItem(Product product, Integer count) {
        super();
        this.product = product;
        this.count = count;
    }
}
